package com.bw.park.ui.login

import com.bw.park.ApiService
import com.bw.park.entity.LoginEntity
import com.mooc.lib_network.BaseRepository
import com.mooc.lib_network.HttpType
import com.mooc.lib_network.NetWorkFactory
import com.mooc.lib_network.entity.NetResult
import retrofit2.Retrofit

class LoginRepo : BaseRepository() {

    //转化后的登录方法

    suspend fun login(str : String):NetResult<LoginEntity>{
        return requestCall ( call={requestLogin(str)} )
    }

    //登录方法
    suspend fun requestLogin(str : String):NetResult<LoginEntity>{
        return handlerResponse(
                NetWorkFactory.factory(HttpType.SIGN)
                        .getRetrofit().create(ApiService::class.java)
                        .requestLogin(createBody(str))
        )
    }

}